<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="pojo.User" %>

<%
User user=(User)session.getAttribute("user");

%>
<%if (session.getAttribute("user") == null) {%>
<h1>Brak dostępu do tej strony!</h1>
<%}else{ 
String name=user.getFirstName();
String surname=user.getLastName();
String email=user.getEmail();
int phone = user.getPhoneNumber();
%>
<h1>Panel Użytkownika</h1>
<div id="gallery_container">
<h3>Edytuj Dane:</h3>
<center><form action="EditAccountServlet" method="POST">
<table>
		<tr>
		<td><label class="panel" for="login">Email: </label></td> <td><input id="email" name="email" type="text" value=<%=email %> /></td>
		</tr>
		
		<tr>
		<td><label class="panel" for="login">Imię: </label></td> <td><input id="name" name="name" type="text" value=<%=name %> /></td> 
		</tr>
		
		<tr>
		<td><label class="panel" for="login">Nazwisko </label></td> <td><input id="surname" name="surname" type="text" value=<%=surname %> /></td> 
		</tr>
		
		<tr>
		<td><label class="panel" for="login">Telefon: </label></td> <td><input id="phone" name="phone" type="text" value=<%=phone %> /></td> 
		</tr>
		
		<tr>
		<td><label class="panel" for="login">Hasło: </label> <td><input id="password" name="password" type="password" /></td> 
		</tr>
		
	
		
		</table> 
		
		<br>
		<input type="submit" class="styled-button-2" value="Zatwierdź"/>
		<br>
		<%if (session.getAttribute("editAccount") != null) {
	%>
	<span><%= session.getAttribute("editAccount") %></span> 
	<%
		session.removeAttribute("editAccount");
		}
	%>
	

</form>
</center>
<br><br>

<h3>Zmień hasło do konta:</h3><br>

<center><form action="ChangePasswordServlet" method="POST">
	<table>
		<tr>
			<td><label class="panel" for="login">Stare Hasło:</label></td>
			<td><input type="password" name="oldPassword" id="oldPassword" /></td>
		</tr>
		<tr>
			<td><label class="panel" for="login">Nowe Hasło:</label></td>
			<td><input type="password" name="newPassword" id="newPassword" /></td>
		</tr>
		<tr>
			<td><label class="panel" for="login">Potwierdź Hasło: </label></td>
			<td><input type="password" name="confirmPassword" id="confirmPassword" /></td>
		</tr>
	</table><br>
	<input type="submit" class="styled-button-2" class="submit" value="Zmień" /><br>
			<%if (session.getAttribute("warning") != null) {
	%>
	<span><%= session.getAttribute("warning") %></span> 
	<%
		session.removeAttribute("warning");
		}
	%>
</form>
</center>
<%} %>
</div>